import {ElMessage, ElMessageBox} from "element-plus";

/**
 * 获取消息提醒
 * @param msg
 * @param type
 */
export function messageTip(msg,type) {
    ElMessage({
        showClose: true,    //是否显示关闭按钮
        message: msg,    //提示的消息内容
        type: type,    //消息类型
    })
}

/**
 * 获取存储在localStorage或sessionStorage中token的key
 * @returns {string}
 */
export function getTokenName(){
    return "dlyk_token";
}

/**
 * 删除存储在localStorage和sessionStorage中的token
 */
export function removeToken(){
    window.sessionStorage.removeItem(getTokenName());
    window.localStorage.removeItem(getTokenName());
}

/**
 * 消息确认提示
 * @param msg
 */
export function messageConfirm(msg){
    return ElMessageBox.confirm(
        msg,
        '系统提醒',
        {
            confirmButtonText: '确定',
            cancelButtonText: '取消',
            type: 'warning',
        }
    )
}
